Skip to content

Commit 39c2ce8

Browse files
Merge pull request #79 from commitd/sh/78-package-fi
fix(build): fixes build so can be more easily used
2 parents 2a1889f + e699702 commit 39c2ce8

File tree

13 files changed

+364
-900
lines changed

13 files changed

+364
-900
lines changed

apps/docs/.storybook/main.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,6 @@ module.exports = {
2424
},
2525
},
2626
framework: '@storybook/react',
27-
core: {
28-
builder: 'webpack4',
29-
},
30-
features: {
31-
postcss: false,
32-
},
33-
34-
webpackFinal: async (config, { configType }) => {
35-
config.resolve?.extensions?.push('*', '.mjs', '.js', '.json')
36-
37-
if(config.module){
38-
config.module.rules.push({
39-
test: /\.mjs$/,
40-
include: /node_modules/,
41-
type: 'javascript/auto'
42-
})
43-
}
44-
return config;
45-
},
4627

4728
previewHead: (head) => (`
4829
${head}

apps/docs/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
"dependencies": {
1717
"@committed/components": "^8.1.3",
1818
"@committed/components-graph": "*",
19-
"@committed/components-graph-react": "*",
20-
"@committed/graph": "*",
21-
"@committed/graph-json": "*",
22-
"@committed/graph-rdf": "*",
2319
"react": "^17.0.1",
2420
"react-dom": "^17.0.1"
2521
},

package-lock.json

Lines changed: 247 additions & 762 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
"@typescript-eslint/parser": "^5.38.1",
7676
"commitizen": "^4.2.4",
7777
"cz-conventional-changelog": "^3.3.0",
78+
"esbuild": "^0.15.10",
79+
"esbuild-node-externals": "^1.5.0",
7880
"eslint": "^7.32.0",
7981
"eslint-config-prettier": "^8.5.0",
8082
"eslint-import-resolver-typescript": "^2.7.1",
@@ -100,7 +102,6 @@
100102
"storybook-dark-mode": "^1.0.8",
101103
"ts-jest": "^29.0.3",
102104
"tslib": "^2.0.3",
103-
"tsup": "^6.2.3",
104105
"turbo": "^1.5.4",
105106
"typescript": "4.7.4"
106107
},

packages/all/package.json

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"author": "Committed",
66
"license": "MIT",
77
"private": false,
8-
"main": "./dist/index.js",
9-
"module": "./dist/esm/index.js",
10-
"typings": "./dist/index.d.ts",
8+
"main": "dist/index.cjs.js",
9+
"module": "dist/index.esm.js",
10+
"types": "dist/index.d.ts",
1111
"sideEffects": false,
1212
"publishConfig": {
1313
"access": "public",
@@ -20,12 +20,14 @@
2020
"node": ">=10"
2121
},
2222
"peerDependencies": {
23-
"@committed/components": ">= 5.0.0",
23+
"@committed/components": ">= 8.0.0",
2424
"react": ">= 16.8.0",
2525
"react-dom": ">= 16.8.0"
2626
},
2727
"devDependencies": {
28-
"@committed/config": "*"
28+
"@committed/config": "*",
29+
"react": "^17.0.2",
30+
"react-dom": "^17.0.2"
2931
},
3032
"dependencies": {
3133
"@committed/graph": "*",
@@ -35,26 +37,15 @@
3537
},
3638
"scripts": {
3739
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
38-
"build": "tsup --legacy-output && tsc",
40+
"build:clean": "rm -rf dist",
41+
"build:ts": "tsc --project tsconfig.json",
42+
"build:js": "node ../../node_modules/@committed/config/esbuild/build.mjs",
43+
"build": "npm run build:clean && npm run build:ts && npm run build:js",
3944
"lint": "tsc && eslint './src/**/*.{ts,tsx}'",
4045
"test": "jest --passWithNoTests",
4146
"test:ci": "jest --coverage --passWithNoTests",
4247
"test:watch": "jest --watch --passWithNoTests",
43-
"precommit": "lint-staged",
44-
"dev": "tsup --watch"
45-
},
46-
"tsup": {
47-
"clean": true,
48-
"entry": [
49-
"src/index.ts"
50-
],
51-
"format": [
52-
"cjs",
53-
"esm"
54-
],
55-
"target": "es2020",
56-
"minify": true,
57-
"sourcemap": true
48+
"precommit": "lint-staged"
5849
},
5950
"repository": {
6051
"type": "git",

packages/config/esbuild/build.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { build } from 'esbuild'
2+
import { nodeExternalsPlugin } from 'esbuild-node-externals'
3+
4+
const entryFile = 'src/index.ts'
5+
const outFolder = 'dist'
6+
7+
const shared = {
8+
bundle: true,
9+
entryPoints: [entryFile],
10+
logLevel: 'info',
11+
minify: true,
12+
sourcemap: true,
13+
target: ['esnext', 'node16'],
14+
plugins: [nodeExternalsPlugin()],
15+
}
16+
17+
build({
18+
...shared,
19+
format: 'esm',
20+
outfile: `${outFolder}/index.esm.js`,
21+
})
22+
23+
build({
24+
...shared,
25+
format: 'cjs',
26+
outfile: `${outFolder}/index.cjs.js`,
27+
})

packages/graph-json/package.json

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"author": "Committed",
66
"private": false,
77
"license": "MIT",
8-
"main": "./dist/index.js",
9-
"module": "./dist/esm/index.js",
10-
"types": "./dist/index.d.ts",
8+
"main": "dist/index.cjs.js",
9+
"module": "dist/index.esm.js",
10+
"types": "dist/index.d.ts",
1111
"sideEffects": false,
1212
"files": [
1313
"dist"
@@ -32,34 +32,25 @@
3232
},
3333
"scripts": {
3434
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
35-
"build": "tsup --legacy-output && tsc --project tsconfig.build.json",
35+
"build:clean": "rm -rf dist",
36+
"build:ts": "tsc --project tsconfig.build.json",
37+
"build:js": "node ../../node_modules/@committed/config/esbuild/build.mjs",
38+
"build": "npm run build:clean && npm run build:ts && npm run build:js",
3639
"lint": "tsc && eslint './src/**/*.{ts,tsx}'",
37-
"dev": "tsup --legacy-output --watch",
3840
"fix": "TIMING=1 eslint src/**/*.ts* --fix",
3941
"test": "jest",
4042
"test:ci": "jest --coverage",
4143
"test:watch": "jest --watchAll",
4244
"precommit": "lint-staged"
4345
},
44-
"tsup": {
45-
"clean": true,
46-
"entry": [
47-
"src/index.ts"
48-
],
49-
"format": [
50-
"cjs",
51-
"esm"
52-
],
53-
"target": "es2020",
54-
"minify": true,
55-
"sourcemap": true,
56-
"tsconfig": "./tsconfig.build.json"
57-
},
5846
"devDependencies": {
47+
"@committed/graph": "*",
5948
"@committed/config": "*"
6049
},
50+
"peerDependencies": {
51+
"@committed/graph": "*"
52+
},
6153
"dependencies": {
62-
"@committed/graph": "*",
6354
"uuid": "^8.3.2"
6455
}
6556
}

packages/graph-rdf/package.json

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"author": "Committed",
66
"private": false,
77
"license": "MIT",
8-
"main": "./dist/index.js",
9-
"module": "./dist/esm/index.js",
10-
"types": "./dist/index.d.ts",
8+
"main": "dist/index.cjs.js",
9+
"module": "dist/index.esm.js",
10+
"types": "dist/index.d.ts",
1111
"sideEffects": false,
1212
"files": [
1313
"dist"
@@ -32,34 +32,25 @@
3232
},
3333
"scripts": {
3434
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
35-
"build": "tsup --legacy-output && tsc --project tsconfig.build.json",
35+
"build:clean": "rm -rf dist",
36+
"build:ts": "tsc --project tsconfig.build.json",
37+
"build:js": "node ../../node_modules/@committed/config/esbuild/build.mjs",
38+
"build": "npm run build:clean && npm run build:ts && npm run build:js",
3639
"lint": "tsc && eslint './src/**/*.{ts,tsx}'",
3740
"test": "jest",
3841
"test:ci": "jest --coverage",
3942
"test:watch": "jest --watchAll",
4043
"precommit": "lint-staged",
41-
"dev": "tsup --legacy-output --watch",
4244
"fix": "TIMING=1 eslint src/**/*.ts* --fix"
4345
},
44-
"tsup": {
45-
"clean": true,
46-
"entry": [
47-
"src/index.ts"
48-
],
49-
"format": [
50-
"cjs",
51-
"esm"
52-
],
53-
"target": "es2020",
54-
"minify": true,
55-
"sourcemap": true,
56-
"tsconfig": "./tsconfig.build.json"
57-
},
5846
"devDependencies": {
47+
"@committed/graph": "*",
5948
"@committed/config": "*"
6049
},
50+
"peerDependencies": {
51+
"@committed/graph": "*"
52+
},
6153
"dependencies": {
62-
"@committed/graph": "*",
6354
"n3": "^1.11.1",
6455
"rdf-literal": "^1.3.0"
6556
}

packages/graph-rdf/src/utils/labels.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const prefixedId =
1313
const match = Object.keys(prefixes).find((prefix) => id.startsWith(prefix))
1414
if (match !== undefined) {
1515
const prefix = prefixes[match]
16-
return `${prefix}:${id.substr(match.length)}`
16+
return `${prefix}:${id.substring(match.length)}`
1717
}
1818
return id
1919
}
@@ -23,7 +23,7 @@ export const fragmentId = (id: string): string => {
2323
const url = new URL(id)
2424
const hash = url.hash
2525
if (hash) {
26-
return hash.substr(1)
26+
return hash.substring(1)
2727
}
2828
const path = url.pathname
2929
return path.substring(path.lastIndexOf('/') + 1)

packages/graph/package.json

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"author": "Committed",
66
"private": false,
77
"license": "MIT",
8-
"main": "./dist/index.js",
9-
"module": "./dist/esm/index.js",
10-
"types": "./dist/index.d.ts",
8+
"main": "dist/index.cjs.js",
9+
"module": "dist/index.esm.js",
10+
"types": "dist/index.d.ts",
1111
"sideEffects": false,
1212
"files": [
1313
"dist"
@@ -32,29 +32,17 @@
3232
},
3333
"scripts": {
3434
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
35-
"build": "tsup --legacy-output && tsc --project tsconfig.build.json",
35+
"build:clean": "rm -rf dist",
36+
"build:ts": "tsc --project tsconfig.build.json",
37+
"build:js": "node ../../node_modules/@committed/config/esbuild/build.mjs",
38+
"build": "npm run build:clean && npm run build:ts && npm run build:js",
3639
"lint": "tsc && eslint './src/**/*.{ts,tsx}'",
3740
"test": "jest",
3841
"test:ci": "jest --coverage",
3942
"test:watch": "jest --watchAll",
4043
"precommit": "lint-staged",
41-
"dev": "tsup --legacy-output --watch",
4244
"fix": "TIMING=1 eslint src/**/*.ts* --fix"
4345
},
44-
"tsup": {
45-
"clean": true,
46-
"entry": [
47-
"src/index.ts"
48-
],
49-
"format": [
50-
"cjs",
51-
"esm"
52-
],
53-
"target": "es2020",
54-
"minify": true,
55-
"sourcemap": true,
56-
"tsconfig": "./tsconfig.build.json"
57-
},
5846
"devDependencies": {
5947
"@committed/config": "*"
6048
},

0 commit comments

Comments
 (0)