Skip to content

Commit 883d926

Browse files
authored
chore: update plugins to use npm workspaces (#2591)
* chore: update blockly-react postinstall script * chore: use npm workspaces for plugins * chore: update docs
1 parent 46f98b7 commit 883d926

13 files changed

Lines changed: 33971 additions & 14303 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ gh-pages/examples
2727
.idea
2828
*.sublime-workspace
2929
.vscode/*
30+
31+
# Nx
32+
.nx/cache
33+
.nx/workspace-data

examples/blockly-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"audit": "npm audit fix",
1313
"update": "npm update",
14-
"postinstall": "cp -r node_modules/blockly/media public/media",
14+
"postinstall": "node postinstall.js",
1515
"predeploy": "npm run build",
1616
"start": "react-scripts start",
1717
"build": "react-scripts build",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const fs = require('fs');
2+
3+
// e.g. node_modules/blockly/index.js
4+
const blocklyIndex = require.resolve('blockly');
5+
6+
// Get the media directory instead of the index
7+
const mediaPath = blocklyIndex.replace('index.js', 'media');
8+
9+
fs.cp(mediaPath, './public/media', {recursive: true}, (err) => {
10+
if (err) throw err;
11+
});

gulpfile.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,11 @@ function deployToGhPages(repo) {
234234
*/
235235
function preparePluginsForLocal(isBeta) {
236236
return (done) => {
237-
const pluginsDirectory = 'plugins';
238237
if (isBeta) {
239-
execSync(`npx lerna exec -- npm install blockly@beta --force `, {
240-
cwd: pluginsDirectory,
238+
execSync(`npm install blockly@beta --force `, {
241239
stdio: 'inherit',
242240
});
243241
}
244-
execSync(`npm run boot`, {stdio: 'inherit'});
245242
// Bundles all the plugins.
246243
execSync(`npm run deploy:prepare:plugins`, {stdio: 'inherit'});
247244
done();
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"packages": ["*"],
32
"version": "independent",
43
"npmClient": "npm",
54
"changelogPreset": {
65
"name": "conventionalcommits"
76
},
8-
"ignoreChanges": ["**/package-lock.json"],
9-
"useNx": false
7+
"ignoreChanges": ["**/package-lock.json"]
108
}

nx.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"targetDefaults": {
3+
"build": {
4+
"cache": true,
5+
"dependsOn": ["^build"],
6+
"outputs": ["{projectRoot}/dist"]
7+
},
8+
"clean": {
9+
"dependsOn": []
10+
},
11+
"deploy:prepare": {
12+
"cache": true,
13+
"dependsOn": [],
14+
"outputs": ["{projectRoot}/dist"]
15+
},
16+
"deploy:prepare:examples": {
17+
"cache": true,
18+
"dependsOn": [],
19+
"outputs": ["{projectRoot}/dist"]
20+
},
21+
"deploy:prepare:plugins": {
22+
"cache": true,
23+
"dependsOn": ["^deploy:prepare:plugins"],
24+
"outputs": ["{projectRoot}/dist"]
25+
},
26+
"deploy": {
27+
"dependsOn": []
28+
},
29+
"deploy:upstream": {
30+
"dependsOn": []
31+
},
32+
"format": {
33+
"cache": true,
34+
"dependsOn": []
35+
},
36+
"format:check": {
37+
"cache": true,
38+
"dependsOn": []
39+
},
40+
"license": {
41+
"dependsOn": []
42+
},
43+
"lint": {
44+
"cache": true,
45+
"dependsOn": []
46+
},
47+
"lint:fix": {
48+
"cache": true,
49+
"dependsOn": []
50+
},
51+
"postinstall": {
52+
"dependsOn": []
53+
},
54+
"test": {
55+
"cache": true,
56+
"dependsOn": ["^test"],
57+
"outputs": ["{projectRoot}/build"]
58+
},
59+
"publish:prepare": {
60+
"dependsOn": ["^publish:prepare"],
61+
"outputs": ["{projectRoot}/dist"]
62+
},
63+
"publish:manual": {
64+
"dependsOn": []
65+
},
66+
"publish:force": {
67+
"dependsOn": []
68+
},
69+
"publish:unpublishedOnly": {
70+
"dependsOn": []
71+
},
72+
"publish:checkVersions": {
73+
"dependsOn": []
74+
},
75+
"test:ghpages:beta": {
76+
"dependsOn": []
77+
},
78+
"test:ghpages": {
79+
"dependsOn": []
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)