Skip to content

Commit

Permalink
Un-hoist some packages, clean up lockfile after sku init test
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed May 7, 2024
1 parent 111c591 commit bf16a84
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
7 changes: 0 additions & 7 deletions .npmrc
Expand Up @@ -2,14 +2,7 @@
public-hoist-pattern[]="*eslint*"
public-hoist-pattern[]="*prettier*"

# `sku` itself needs these to be hoisted
public-hoist-pattern[]="babel-loader"
public-hoist-pattern[]="css-loader"

# This is only necessary in this repo because pnpm symlinks the sku dependency in fixtures to the sku package folder directly
# This bypasses the .pnpm folder that resolveModules looks for
# See https://github.com/seek-oss/sku/blob/275752bd3066e52885d461ef5bcd953aaac3bfff/config/webpack/resolveModules.js
public-hoist-pattern[]="@babel/*"

# Ensure that the same TypeScript version used by sku is used by the monorepo
public-hoist-pattern[]="typescript"
1 change: 1 addition & 0 deletions fixtures/sku-webpack-plugin/package.json
Expand Up @@ -8,6 +8,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"babel-loader": "^9.1.2",
"mini-css-extract-plugin": "^2.6.1",
"html-webpack-plugin": "^5.3.2",
"sku": "workspace:*"
Expand Down
15 changes: 4 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 19 additions & 6 deletions tests/sku-init.test.js
@@ -1,24 +1,37 @@
const path = require('node:path');
const fs = require('node:fs');
const { rimraf } = require('rimraf');
const fs = require('node:fs/promises');
const { promisify } = require('node:util');
const exec = promisify(require('node:child_process').exec);
const { runSkuScriptInDir } = require('@sku-private/test-utils');

const fixtureDirectory = path.join(__dirname, '../fixtures/sku-init');
const projectName = 'new-project';
const projectDirectory = path.join(fixtureDirectory, projectName);

describe('sku init', () => {
beforeAll(async () => {
await fs.rm(projectDirectory, { recursive: true, force: true });
});

afterAll(async () => {
await fs.rm(projectDirectory, { recursive: true, force: true });

console.log(
"Running 'pnpm install' to clean up lockfile after sku-init test...",
);
await exec('pnpm install');
});

it(
'should create a sku.config.ts',
async () => {
const projectName = 'new-project';
await rimraf(path.join(fixtureDirectory, projectName));

const { child } = await runSkuScriptInDir('init', fixtureDirectory, [
projectName,
]);

expect(child.exitCode).toBe(0);

const skuConfig = fs.readFileSync(
const skuConfig = await fs.readFile(
path.join(fixtureDirectory, projectName, 'sku.config.ts'),
'utf-8',
);
Expand Down

0 comments on commit bf16a84

Please sign in to comment.