Skip to content

Commit 9e9b7b2

Browse files
authored
Rename ./scripts -> ./tool; use only local npm packages (#1133)
* Only use local npm packages * Rename ./scripts -> ./tool * Adjust README and scripts: use new tool/ path
1 parent da8984f commit 9e9b7b2

26 files changed

+72
-61
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ _site/
1717
build
1818
node_modules/
1919
pubspec.lock
20-
scripts/packages
20+
2121
# We haven't had any issues due to npm (sub-)package version discrepancies,
2222
# so we'll ignore the npm lock file for now.
2323
package-lock.json

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "site-shared"]
22
path = site-shared
33
url = https://github.com/dart-lang/site-shared.git
4-
branch = chalin-bootstrap-4-0823
4+
branch = master

.travis.yml

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: dart
2-
dart: stable
2+
dart: [stable, dev]
33

44
cache:
55
timeout: 300
@@ -15,29 +15,28 @@ env:
1515
- JEKYLL_ENV=production
1616
- TZ=US/Pacific # normalize build timestamp
1717
matrix:
18-
- TASK="./scripts/check-code.sh"
19-
- TASK="./scripts/analyze-and-test-examples.sh"
18+
- TASK="./tool/check-code.sh"
19+
- TASK="./tool/analyze-and-test-examples.sh"
2020
- TASK="bundle exec jekyll build"
2121

2222
matrix:
23-
# Once we start building under stable again, reactivate the following exclusion:
24-
# exclude:
25-
# - env: TASK="bundle exec jekyll build"
26-
# dart: dev
23+
exclude:
24+
- env: TASK="bundle exec jekyll build"
25+
dart: dev
2726

2827
before_install:
29-
- source ./scripts/env-set.sh
30-
- ./scripts/before-install.sh
28+
- source ./tool/env-set.sh
29+
- ./tool/before-install.sh
3130

3231
install:
33-
- ./scripts/install.sh
34-
- ./scripts/write-ci-info.sh -v
32+
- ./tool/install.sh
33+
- ./tool/write-ci-info.sh -v
3534

3635
script:
3736
- $TASK
3837

3938
after_script:
40-
- if [[ $TASK == *build* ]]; then ./scripts/shared/check-links.sh || travis_terminate 1; fi
39+
- if [[ $TASK == *build* ]]; then ./tool/shared/check-links.sh || travis_terminate 1; fi
4140
# Just FYI test. Won't fail the build if it has errors.
4241
# - if [[ $TASK == *build* ]]; then ./deploy/check_sitemap.rb; fi
4342
# - if [[ $TASK == *build* ]]; then ./deploy/html_proof.rb; fi

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ if you already have the required packages installed.
5454

5555
1. <code>cd <i>\<path-to-this-repo></i></code> &nbsp;&nbsp;# change to
5656
**root of this repo**
57-
1. `source ./scripts/env-set.sh` &nbsp;&nbsp;#
57+
1. `source ./tool/env-set.sh` &nbsp;&nbsp;#
5858
initialize environment variables; install/use required Node & Ruby version
59-
1. `./scripts/before-install.sh` &nbsp;&nbsp;#
59+
1. `./tool/before-install.sh` &nbsp;&nbsp;#
6060
install core set of required tools
61-
1. `./scripts/install.sh` &nbsp;&nbsp;#
61+
1. `./tool/install.sh` &nbsp;&nbsp;#
6262
install everything else needed to build this site
6363

6464
> IMPORTANT:
@@ -74,7 +74,7 @@ Once everything is installed, you need to do a full site build at least once:
7474

7575
The generated site is placed in the `site.g` folder. To serve this folder use:
7676

77-
- `superstatic --port 4000`
77+
- `npx superstatic --port 4000`
7878

7979
Or, if you aren't testing redirects, use this command (which has the bonus of
8080
autorefreshing your browser after edits):
@@ -85,14 +85,14 @@ To view the generated site open [localhost:4000](http://localhost:4000) in a bro
8585

8686
You can build, serve, and have a watcher for changes by running the following command:
8787

88-
- `./scripts/serve.sh`
88+
- `./tool/serve.sh`
8989

9090
## Pre-push checks
9191

9292
If you've made changes to this site's documentation and committed locally, then
9393
run the following command before pushing your work:
9494

95-
./scripts/pre-push.sh
95+
./tool/pre-push.sh
9696

9797
If the script reports errors or warnings, then address the issues and rerun the
9898
script. Otherwise, you can push your changes.
@@ -103,9 +103,9 @@ script. Otherwise, you can push your changes.
103103

104104
If you've made changes to the example code run the following commands:
105105

106-
- `./scripts/dartfmt.sh`
107-
- `./scripts/refresh-code-excerpts.sh`
108-
- `./scripts/analyze-and-test-examples.sh -q`
106+
- `./tool/dartfmt.sh`
107+
- `./tool/refresh-code-excerpts.sh`
108+
- `./tool/analyze-and-test-examples.sh -q`
109109

110110
If the last command reports failed tests and you'd like to know which
111111
test failed, then rerun the command without the `-q` flag.
@@ -115,7 +115,7 @@ test failed, then rerun the command without the `-q` flag.
115115
First, build the site and launch the server:
116116

117117
```
118-
jekyll build && superstatic --port 4000
118+
jekyll build && npx superstatic --port 4000
119119
```
120120

121121
Next, to check for broken links,

examples/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dartanalyzer .
4444
To run both the analyzer and tests:
4545

4646
```
47-
./scripts/analyze-and-test-examples.sh
47+
./tool/analyze-and-test-examples.sh
4848
```
4949

5050
If you get a warning about test failures or analysis errors,
@@ -53,11 +53,11 @@ you might need to update one or more analyzer results files
5353

5454
To update an analyzer results file:
5555

56-
1. Run `./scripts/analyze-and-test-examples.sh --save-logs`.
56+
1. Run `./tool/analyze-and-test-examples.sh --save-logs`.
5757
2. Look at the diffs for the results files.
5858
3. If the diffs look good but some comments are missing,
5959
add back the comments that are still relevant.
60-
4. Run `./scripts/analyze-and-test-examples.sh` to confirm that
60+
4. Run `./tool/analyze-and-test-examples.sh` to confirm that
6161
your changes are good.
6262

6363

@@ -121,7 +121,7 @@ will display as
121121

122122
The code excerpt extractor can apply regular-expression-based replace transformations.
123123
There are global transformations applied to all code excerpts. See
124-
`./scripts/refresh-code-excerpts.sh` for an annotated list of replace expressions passed
124+
`./tool/refresh-code-excerpts.sh` for an annotated list of replace expressions passed
125125
along with the `--replace` command line argument of the `code_excerpt_updater` command.
126126

127127
File-scope global replace expressions are included at the top of some of site page markdown files.

package.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "www.dartlang.org",
3+
"version": "0.0.0",
4+
"private": true,
5+
"description": "www.dartlang.org",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/dart-lang/site-www.git"
9+
},
10+
"devDependencies": {
11+
"firebase-tools": "4.0.3",
12+
"superstatic": "^5.0.2"
13+
}
14+
}

scripts/analyze-and-test-examples.sh tool/analyze-and-test-examples.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Don't exit on pipefail because we use `find`.
66
# set -e -o pipefail
77

8-
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./scripts/env-set.sh
8+
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./tool/env-set.sh
99

1010
cd `dirname $0`/..
1111
ROOT=$(pwd)

scripts/before-install.sh tool/before-install.sh

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
set -e -o pipefail
44

5-
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./scripts/env-set.sh
5+
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./tool/env-set.sh
66

77
if [[ "$1" == --force ]]; then FORCE=1; fi
88

99
if [[ -n "$TRAVIS" ]]; then
10-
./scripts/env-info-and-check.sh
10+
./tool/env-info-and-check.sh
1111
# travis_fold start before_install.update_apt_get
1212
# (set -x; sudo apt-get update --yes)
1313
# travis_fold end before_install.update_apt_get
@@ -22,15 +22,7 @@ travis_fold start before_install.ruby_bundler
2222
fi
2323
travis_fold end before_install.ruby_bundler
2424

25-
./scripts/install-dart-sdk.sh
26-
27-
travis_fold start before_install.npm_install
28-
if [[ -n "$TRAVIS" || -n "$FORCE" || -z "$(type -t firebase)" || -z "$(type -t gulp)" || -z "$(type -t superstatic)" ]]; then
29-
(set -x; npm install --global firebase-tools@4.0.3 gulp-cli superstatic@5.0.2 --no-optional)
30-
else
31-
echo "Global NPM packages already installed. Use --force to reinstall/update."
32-
fi
33-
travis_fold end before_install.npm_install
25+
./tool/install-dart-sdk.sh
3426

3527
travis_fold start before_install.pub
3628
pub upgrade

scripts/check-code.sh tool/check-code.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ set -e -o pipefail
44

55
readonly rootDir="$(cd "$(dirname "$0")/.." && pwd)"
66

7-
[[ -z "$DART_SITE_ENV_DEFS" ]] && . $rootDir/scripts/env-set.sh
7+
[[ -z "$DART_SITE_ENV_DEFS" ]] && . $rootDir/tool/env-set.sh
88

99
travis_fold start dartfmt
10-
(set -x; $rootDir/scripts/dartfmt.sh)
10+
(set -x; $rootDir/tool/dartfmt.sh)
1111
travis_fold end dartfmt
1212

1313
errorMessage="
1414
Error: some code excerpts need to be refreshed.
15-
Rerun '$rootDir/scripts/refresh-code-excerpts.sh' locally.
15+
Rerun '$rootDir/tool/refresh-code-excerpts.sh' locally.
1616
"
1717

1818
travis_fold start refresh_code_excerpts
19-
(set -x; $rootDir/scripts/refresh-code-excerpts.sh) || (printf "$errorMessage" && exit 1)
19+
(set -x; $rootDir/tool/refresh-code-excerpts.sh) || (printf "$errorMessage" && exit 1)
2020
travis_fold end refresh_code_excerpts
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/dartfmt.sh tool/dartfmt.sh

File renamed without changes.

scripts/env-info-and-check.sh tool/env-info-and-check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e -o pipefail
44

5-
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./scripts/env-set.sh
5+
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./tool/env-set.sh
66

77
travis_fold start env_info
88
echo ENVIRONMENT INFO

scripts/env-set.sh tool/env-set.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This bash file is meant to be source'd, not executed.
22

3-
source scripts/shared/env-set.sh
3+
source tool/shared/env-set.sh
44

55
# site-www specific settings here: currently, none.
File renamed without changes.

scripts/install-dart-sdk.sh tool/install-dart-sdk.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
set -e -o pipefail
44

5-
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./scripts/env-set.sh
5+
[[ -z "$DART_SITE_ENV_DEFS" ]] && . ./tool/env-set.sh
66

77
if [[ -z "$(type -t dart)" ]]; then
88
travis_fold start install.dart
9-
echo INSTALLING Dart SDK and Dartium ...
9+
echo INSTALLING Dart SDK ...
1010

11-
# URLs for sdk and dartium:
1211
# https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-linux-x64-release.zip
13-
# https://storage.googleapis.com/dart-archive/channels/stable/release/latest/dartium/dartium-macos-x64-release.zip
1412

1513
: ${DART_CHANNEL:=$(node -p 'require("./src/_data/pkg-vers.json").SDK.channel')} # dev or stable
1614

@@ -46,7 +44,7 @@ if [[ -z "$(type -t dart)" ]]; then
4644
if [[ "1000" -lt "$(wc -c $TMP/$zip | awk '{print $1}')" ]]; then
4745
unzip "$TMP/$zip" -d "$PKG" > /dev/null
4846
rm -f "$TMP/$zip"
49-
# PATH is set in ./scripts/env-set.sh
47+
# PATH is set in ./tool/env-set.sh
5048
else
5149
echo FAILED to download Dart $pkg. Check URL.
5250
exitStatus=1;
@@ -61,6 +59,6 @@ if [[ -z "$(type -t dart)" ]]; then
6159
travis_fold end install.dart
6260
else
6361
echo Dart SDK appears to be installed: `type dart`
64-
# PATH is set in ./scripts/env-set.sh
62+
# PATH is set in ./tool/env-set.sh
6563
dart --version
6664
fi

scripts/install.sh tool/install.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ else
1313
echo "Node version: $(node --version)"
1414
fi
1515

16-
travis_fold start install.bundle
17-
(set -x; bundle install)
18-
travis_fold end install.bundle
16+
travis_fold start install.npm_install
17+
(set -x; npm install --no-optional)
18+
travis_fold end install.npm_install
19+
20+
if [[ "$CI_TASK" == build* ]]; then
21+
travis_fold start install.bundle
22+
(set -x; bundle install)
23+
travis_fold end install.bundle
24+
fi
25+
26+
echo "Installation done"

scripts/pre-push.sh tool/pre-push.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ fi
1212
STATUS=0
1313
set -x
1414

15-
./scripts/dartfmt.sh | grep -v Unchanged && \
16-
./scripts/refresh-code-excerpts.sh && \
17-
./scripts/analyze-and-test-examples.sh $* && \
15+
./tool/dartfmt.sh | grep -v Unchanged && \
16+
./tool/refresh-code-excerpts.sh && \
17+
./tool/analyze-and-test-examples.sh $* && \
1818
pushd deploy/effective-dart-rules && pub get && \
1919
popd && \
2020
dart deploy/effective-dart-rules/bin/main.dart
File renamed without changes.

scripts/refresh-code-excerpts.sh tool/refresh-code-excerpts.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function usage() {
1313

1414
if [[ $1 == '-h' || $1 == '--help' ]]; then usage; fi
1515

16-
[[ -z "$DART_SITE_ENV_DEFS" ]] && . $rootDir/scripts/env-set.sh
16+
[[ -z "$DART_SITE_ENV_DEFS" ]] && . $rootDir/tool/env-set.sh
1717
[[ -z "$DART_SITE_ENV_DEFS" ]] && exit 1; # env-set failed, abort.
1818

1919
ARGS=''
@@ -23,7 +23,7 @@ if [[ -e "$FRAG" ]]; then echo Deleting old "$FRAG"; rm -Rf "$FRAG"; fi
2323

2424
if [[ $1 == '--legacy' ]]; then
2525
shift
26-
$(npm bin)/code-excerpter examples "$FRAG"
26+
npx code-excerpter examples "$FRAG"
2727
else
2828
ARGS+='--yaml '
2929
if [[ ! -e "pubspec.lock" ]]; then pub get; fi

scripts/serve.sh tool/serve.sh

File renamed without changes.

scripts/shared tool/shared

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)