Skip to content

Commit

Permalink
Initial commit using loom
Browse files Browse the repository at this point in the history
  • Loading branch information
mkevinosullivan committed Nov 24, 2022
1 parent 30530a1 commit 0ce09d3
Show file tree
Hide file tree
Showing 52 changed files with 9,195 additions and 755 deletions.
16 changes: 15 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
es2021: true,
},
extends: ['plugin:@shopify/typescript', 'plugin:@shopify/prettier'],
ignorePatterns: ['dist/'],
ignorePatterns: ['build/', 'tmp/'],
rules: {
'import/no-named-as-default': 0,
'no-mixed-operators': 0,
Expand All @@ -13,4 +13,18 @@ module.exports = {
'import/no-cycle': 0,
'@typescript-eslint/naming-convention': 0,
},
overrides: [
{
files: ['packages/*/loom.config.ts', 'tests/setup/setup-jest.ts'],
rules: {
'import/no-extraneous-dependencies': 0,
},
},
{
files: ['**/.eslintrc.js'],
rules: {
'no-undef': 'off',
},
},
],
};
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
with:
node-version: ${{ matrix.version }}
- name: Install
run: bin/ci_install_deps
run: yarn install
- name: Run tests
run: bin/ci_test
# - name: Run linting
# run: bin/ci_lint
run: yarn test
- name: Run linting
run: yarn lint
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
node_modules
.DS_STORE
yarn-error.log
dist
dist/
build/
coverage/
yarn-error.log
tsdocs/
tsconfig.tsbuildinfo
packages/**/*.d.ts
Expand All @@ -12,3 +12,4 @@ packages/**/*.js
packages/**/*.js.map
packages/**/*.tgz
tmp/
.loom
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@shopify/prettier-config"
5 changes: 4 additions & 1 deletion bin/ci_clean
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash

for package in packages/*/
# for package in packages/*/
for package in packages/shopify-app-session-storage \
packages/shopify-app-session-storage-test-utils \
packages/shopify-app-session-storage-memory
do
echo "Cleaning ${package}"
(cd ${package} && yarn clean)
Expand Down
5 changes: 4 additions & 1 deletion bin/ci_lint
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash

for package in packages/*/
# for package in packages/*/
for package in packages/shopify-app-session-storage \
packages/shopify-app-session-storage-test-utils \
packages/shopify-app-session-storage-memory
do
echo "Testing ${package}"
(cd ${package} && yarn lint)
Expand Down
36 changes: 36 additions & 0 deletions loom.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {createWorkspace, createWorkspacePlugin} from '@shopify/loom';
import {buildLibraryWorkspace} from '@shopify/loom-plugin-build-library';
import {eslint} from '@shopify/loom-plugin-eslint';
import {prettier} from '@shopify/loom-plugin-prettier';

import type {} from '@shopify/loom-plugin-jest';

export default createWorkspace((workspace) => {
workspace.use(
buildLibraryWorkspace(),
eslint(),
prettier({files: '**/*.{json,md}'}),
jestWorkspaceConfigPlugin(),
);
});

function jestWorkspaceConfigPlugin() {
return createWorkspacePlugin(
'shopify-app-js--workplace-setup',
({tasks: {test}}) => {
test.hook(({hooks}) => {
hooks.configure.hook((configure) => {
configure.jestSetupFilesAfterEnv?.hook((files) => [
...files,
'../../tests/setup/setup-jest.ts',
]);
// Increase the test timeout to 20 seconds
configure.jestConfig?.hook((config) => ({
...config,
testTimeout: 20000,
}));
});
});
},
);
}
73 changes: 0 additions & 73 deletions nx.json

This file was deleted.

29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "shopify-app-js--root",
"version": "1.0.0",
"license": "UNLICENSED",
"private": true,
"scripts": {
"build": "loom build",
"test": "loom test",
"lint": "loom lint",
"clean": "bin/ci_clean"
},
"devDependencies": {
"@shopify/eslint-plugin": "^42.0.1",
"@shopify/loom": "^1.0.2",
"@shopify/loom-cli": "^1.0.2",
"@shopify/loom-plugin-build-library": "^1.0.3",
"@shopify/loom-plugin-eslint": "^2.0.1",
"@shopify/loom-plugin-jest": "^1.0.2",
"@shopify/loom-plugin-prettier": "^2.0.1",
"@shopify/prettier-config": "^1.1.2",
"@shopify/typescript-configs": "^5.1.0",
"eslint": "^8.28.0",
"typescript": "^4.9.3"
},
"dependencies": {},
"workspaces": [
"packages/*"
]
}
42 changes: 0 additions & 42 deletions package.json.ignore

This file was deleted.

14 changes: 0 additions & 14 deletions packages/shopify-app-express/jest.config.ts

This file was deleted.

27 changes: 27 additions & 0 deletions packages/shopify-app-express/loom.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {createPackage, createProjectPlugin} from '@shopify/loom';
import {buildLibrary} from '@shopify/loom-plugin-build-library';

export default createPackage((pkg) => {
pkg.entry({root: './src/index.ts'});
pkg.use(
buildLibrary({
// Required. A browserslist string for specifying your target output.
// Use browser targets (e.g. `'defaults'`) if your package targets the browser,
// node targets (e.g. `'node 12.22'`) if your package targets node
// or both (e.g.`'defaults, node 12.22'`) if your package targets both
targets: 'node 14',
// Optional. Defaults to false. Defines if commonjs outputs should be generated.
commonjs: true,
// Optional. Defaults to false. Defines if esmodules outputs should be generated.
esmodules: false,
// Optional. Defaults to false. Defines if esnext outputs should be generated.
esnext: false,
// Optional. Defaults to true. Defines if entrypoints should be written at
// the root of the repository. You can disable this if you have a single
// entrypoint or if your package uses the `exports` key in package.json
rootEntrypoints: false,
// Optional. Defaults to 'node'. Defines if the jest environment should be 'node' or 'jsdom'.
jestTestEnvironment: 'node',
}),
);
});
24 changes: 6 additions & 18 deletions packages/shopify-app-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,9 @@
"homepage": "https://github.com/Shopify/shopify-app-express/tree/main/packages/shopify-app-express",
"author": "Shopify Inc.",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"prettier": "@shopify/prettier-config",
"scripts": {
"test:all": "jest",
"test": "jest --selectProjects package",
"test:dev": "jest --selectProjects package lint",
"lint": "jest --selectProjects lint",
"clean": "yarn tsc --build --clean",
"prebuild": "yarn tsc --build --clean",
"build": "tsc",
"prepublishOnly": "yarn run build",
"preversion": "yarn run test",
"postversion": "git push origin main --follow-tags && echo \"Log in to shipit to deploy version $npm_package_version\""
},
"main": "./build/cjs/index.js",
"types": "./build/ts/index.d.ts",
"scripts": {},
"publishConfig": {
"access": "public"
},
Expand All @@ -43,8 +31,8 @@
],
"dependencies": {
"@shopify/shopify-api": "^6.0.0-rc9",
"@shopify/shopify-app-session-storage": "../shopify-app-session-storage/shopify-shopify-app-session-storage-1.0.0-rc1.tgz",
"@shopify/shopify-app-session-storage-memory": "../shopify-app-session-storage-memory/shopify-shopify-app-session-storage-memory-1.0.0-rc1.tgz",
"@shopify/shopify-app-session-storage": "^1.0.0-rc1",
"@shopify/shopify-app-session-storage-memory": "^1.0.0-rc1",
"cookie-parser": "^1.4.6",
"express": "^4.18.1",
"tslib": "^2.4.0"
Expand Down Expand Up @@ -77,7 +65,7 @@
"typescript": "^4.7.4"
},
"files": [
"dist/*",
"build/*",
"!bundle/*",
"!tsconfig.tsbuildinfo",
"!node_modules"
Expand Down
Loading

0 comments on commit 0ce09d3

Please sign in to comment.