Skip to content

Commit 5e3c40b

Browse files
authored
Merge pull request #1939 from plotly/use-npm-ci
npm clean-install
2 parents 2ec0238 + 395fd3c commit 5e3c40b

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
set -eo pipefail
5454
pip install -e .[ci,dev,testing,celery,diskcache] --progress-bar off
5555
pip list | grep dash
56-
npm i
56+
npm ci
5757
npm run build.sequential
5858
python setup.py sdist
5959
mkdir dash-package && cp dist/*.tar.gz dash-package/dash-package.tar.gz
@@ -119,7 +119,7 @@ jobs:
119119
. venv/bin/activate
120120
set -eo pipefail
121121
pip install -e . --progress-bar off && pip list | grep dash
122-
npm install npm run initialize
122+
npm ci npm run initialize
123123
npm run build.sequential
124124
npm run lint
125125
- run:
@@ -189,7 +189,7 @@ jobs:
189189
name: ️️🏗️ Install package
190190
command: |
191191
. venv/bin/activate
192-
npm install
192+
npm ci
193193
pip install dash-package/dash-package.tar.gz[ci,dev,testing,celery,diskcache] --progress-bar off
194194
pip list | grep dash
195195
- run:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ python3 -m venv .venv/dev
1515
$ source .venv/dev/bin/activate
1616
# install dash and dependencies
1717
$ pip install -e .[ci,dev,testing,celery,diskcache] # in some shells you need \ to escape []
18-
$ npm install
18+
$ npm ci
1919
# this script will build the dash-core-components, dash-html-components, dash-table,
2020
# and renderer bundles; this will build all bundles from source code in their
2121
# respective directories. The only true source of npm version is defined

components/dash-core-components/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ python -m venv venv && . venv/bin/activate
1818
$ pip install -e .[dev,testing] # in some shells you need \ to escape []
1919

2020
# run the build process - this will build all of dash, including dcc
21-
$ npm i && npm run build
21+
$ npm ci && npm run build
2222

2323
# install dcc in editable mode
2424
$ pip install -e .

components/dash-html-components/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Vanilla HTML components for [Dash][]
1717
```
1818
3. Generate components and install npm packages
1919
```
20-
$ npm install
20+
$ npm ci
2121
```
2222
2323
### Generating HTML Components

dash/development/update_components.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class _CombinedFormatter(
2020
)
2121

2222

23-
def bootstrap_components(components_source, concurrency):
23+
def bootstrap_components(components_source, concurrency, install_type):
2424

2525
is_windows = sys.platform == "win32"
2626

@@ -30,7 +30,7 @@ def bootstrap_components(components_source, concurrency):
3030
else "dash-core-components|dash-html-components|dash-table"
3131
)
3232

33-
cmdstr = f"npx lerna exec --concurrency {concurrency} --scope *@({source_glob})* -- npm i"
33+
cmdstr = f"npx lerna exec --concurrency {concurrency} --scope *@({source_glob})* -- npm {install_type}"
3434
cmd = shlex.split(cmdstr, posix=not is_windows)
3535
print(cmdstr)
3636

@@ -144,10 +144,17 @@ def cli():
144144
default=3,
145145
help="Maximum concurrent steps, up to 3 (ie all components in parallel)",
146146
)
147+
parser.add_argument(
148+
"--ci",
149+
help="For clean-install use '--ci True'",
150+
default="False",
151+
)
147152

148153
args = parser.parse_args()
149154

150-
bootstrap_components(args.components_source, args.concurrency)
155+
bootstrap_components(
156+
args.components_source, args.concurrency, "ci" if args.ci == "True" else "i"
157+
)
151158
build_components(args.components_source, args.concurrency)
152159

153160

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"private::format.renderer": "cd dash/dash-renderer && npm run format",
77
"private::format.dcc": "cd components/dash-core-components && npm run format",
88
"private::initialize.renderer": "cd dash/dash-renderer && npm ci",
9+
"private::cibuild.components": "python dash/development/update_components.py 'all' --ci True",
910
"private::build.components": "python dash/development/update_components.py 'all'",
11+
"private::cibuild.renderer": "cd dash/dash-renderer && renderer build",
1012
"private::build.renderer": "cd dash/dash-renderer && renderer build",
1113
"private::lint.black": "if [[ ${PYVERSION:-python39} != python36 ]]; then black dash tests --exclude metadata_test.py --check; fi",
1214
"private::lint.flake8": "flake8 --exclude=metadata_test.py dash tests",
@@ -26,6 +28,7 @@
2628
"private::test.unit-renderer": "cd dash/dash-renderer && npm run test",
2729
"private::test.integration-dash": "TESTFILES=$(circleci tests glob \"tests/integration/**/test_*.py\" | circleci tests split --split-by=timings) && pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml ${TESTFILES} --reruns 3",
2830
"private::test.integration-dash-import": "cd tests/integration/dash && python dash_import_test.py",
31+
"cibuild": "run-s private::cibuild.*",
2932
"build": "run-s private::build.*",
3033
"build.sequential": "npm run private::build.renderer && npm run private::build.components -- --concurrency 1",
3134
"format": "run-s private::format.*",

0 commit comments

Comments
 (0)