forked from stripe/stripe-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
86 lines (65 loc) · 2.93 KB
/
Copy pathjustfile
File metadata and controls
86 lines (65 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
set quiet
import? '../sdk-codegen/utils.just'
# make locally installed binaries available throughout the tree without a longer specifier
# this is useful in this file, but also depended on by webhook tests that expect to be able to call `eslint` and (I think) don't set it up correctly themselves.
export PATH := `pwd` + "/node_modules/.bin:" + env('PATH')
_default:
just --list --unsorted
# ⭐ run format, lint, and tests to prepare for CI
prepare: format lint test types-test
# this uses positional-args so that mixed quoted and unquoted arguments
# (like filtering for a certain test) work the way we expect
# ⭐ run unit tests
[positional-arguments]
test *args: install build
mocha "$@"
# try to compile the example TS file to make sure exports work
types-test: build
for dir in types types-cjs types-cjs-node16; do \
if [ ! -d "testProjects/$dir/node_modules" ]; then (cd "testProjects/$dir" && npm install); fi; \
tsc --build "testProjects/$dir"; \
done
# run full integration tests by installing a bunch of packages and starting servers (slow)
integrations-test: build
RUN_INTEGRATION_TESTS=1 mocha test/Integration.spec.ts
# run the full test suite; you probably want `test`
ci-test: install test types-test integrations-test
_build mode packageType tscArgs: install
mkdir -p {{ mode }}
tsc -p tsconfig.{{ mode }}.json {{ tscArgs }}
echo '{"type":"{{ packageType }}"}' > {{ mode }}/package.json
[private]
build-esm *args="": (_build "esm" "module" args)
[private]
build-cjs *args="": (_build "cjs" "commonjs" args)
# generate CJS and ESM versions of the package; mostly used as a pre-req for other steps
build: build-esm build-cjs
# generate CJS and ESM versions of the package including sourceMaps for each build
build-dev: (build-esm "--sourceMap" "true") (build-cjs "--sourceMap" "true")
# ⭐ run style checks, fixing issues if possible
lint: (lint-check "--fix")
# run style checks without changing anything
lint-check *args: install
eslint --rulesdir eslint-rules --ext .js,.ts . {{ args }}
# reinstall dependencies, if needed
install:
yarn {{ if is_dependency() == "true" { "--silent" } else { "" } }}
[no-exit-message]
[private]
prettier *args: install
# all the project-relevant JS code
prettier "{src,examples,scripts,test,types}/**/*.{ts,js}" {{ args }}
# ⭐ format all files
format: (prettier "--write --loglevel error")
# verify formatting of files (without changes)
format-check: (prettier "--check")
# called by tooling
[private]
update-version version:
echo "{{ version }}" > VERSION
perl -pi -e 's|"version": "[.\-\d\w]+"|"version": "{{ version }}"|' package.json
perl -pi -e "s|static PACKAGE_VERSION = '[.\-\d\w]+'|static PACKAGE_VERSION = '{{ version }}'|" src/stripe.core.ts
perl -pi -e "s|static PACKAGE_VERSION = '[.\-\d\w]+'|static PACKAGE_VERSION = '{{ version }}'|" src/stripe.esm.node.ts
# remove build artifacts
clean:
rm -rf ./node_modules/.cache ./esm ./cjs