Skip to content

Commit

Permalink
style: 'unicorn/no-await-expression-member': 'on',
Browse files Browse the repository at this point in the history
  • Loading branch information
jjangga0214 committed Nov 7, 2023
1 parent 8b1a567 commit 7491644
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 45 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module.exports = {
extends: '@jjangga0214/eslint-config',
rules: {
'unicorn/no-await-expression-member': 'off',
},
settings: {
react: {
version: '18',
Expand Down
88 changes: 67 additions & 21 deletions examples/basic-typescript/haetae.config.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,75 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { utils, configure } from 'haetae'
/* eslint-disable import/no-extraneous-dependencies */
import { $, configure, utils, git, js, pkg, core } from 'haetae'
import url from 'node:url'
import semver from 'semver'

export default configure({
env: async (env, { store }) => ({
...env,
hihi: store.hi(),
haetaeConfig: await utils.hash(
await js.deps({ entrypoint: url.fileURLToPath(import.meta.url) }),
// await js.deps({ entrypoint: 'haetae.config.ts' }),
),
}),
recordData: async (data, { store }) => ({
hihi: store.hi(),
...data,
}),
commands: {
myAwesomeCommand: {
run: async () => {
const stdout = await utils.exec('echo hello, world!')
console.log(stdout)
},
env: {
NODE_ENV: process.env.NODE_ENV,
},
},
myAnotherCommand: {
run: async () => {
const stdout = await utils.exec('echo hello, world!')
console.log(stdout)
return {
hi: stdout,
myTest: {
env: async ({ store }) => ({
hi: store.hi(),
jest: await js.majorVersion('jest'),
jestSharableConfig: await js.majorVersion('@jjangga0214/jest-config'),
jestConfig: await utils.hash(['../../jest.config.js']),
node: semver.major(process.version),
haetae: pkg.version.major,
typescript: await js.untilMinorVersion('typescript'),
tsConfig: await utils.hash(['tsconfig.json', '../../tsconfig.json']),
t: 5,
}),
run: async ({ store }) => {
console.log(store.hi())
const changedFiles = await git.changedFiles({
rootDir: '../../',
})
console.log('changedFiles:', changedFiles)
const previousRecord = await store.getRecord()
console.log('previousRecord:', previousRecord)
const changedHashFiles = await utils.changedFiles(['.env'], {})
console.log('changedHashFiles:', changedHashFiles)
changedFiles.push(...changedHashFiles)
const testFiles = await utils.glob(['test/**/*.test.ts'])
const additionalGraph = await utils.graph({
edges: [
{
dependents: ['src/index.ts'],
dependencies: ['.env'],
},
],
})
console.log('testFiles:', testFiles)
const affectedTestFiles = await js.dependOn({
dependents: testFiles,
dependencies: changedFiles,
additionalGraph,
tsConfig: 'tsconfig.json',
})
console.log('affectedTestFiles:', affectedTestFiles)

if (affectedTestFiles.length > 0) {
const stdout = await $`pnpm test:haetae ${affectedTestFiles}`
console.log(stdout)
}
},
env: async () => ({
NODE_ENV: process.env.NODE_ENV,
ji: 's',
}),
},
myGreeting: {
run: () => ({ hello: 'world' }),
},
},
store: {
...core.localFileStore(),
hi: () => 'hi',
},
})
17 changes: 3 additions & 14 deletions examples/basic-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@haetae/example-basic-typescript",
"version": "0.0.1",
"description": "A basic example project using Haetae",
"description": "A bassic example project using Haetae",
"license": "MIT",
"private": true,
"type": "module",
Expand All @@ -10,25 +10,14 @@
"ts": "node --loader ts-node/esm --loader ../../loader.js",
"lint": "eslint --ext .js,.cjs,.mjs,.jsx,.ts,.tsx,.md .",
"lint:md": "markdownlint .",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage -c ../../jest.config.js ./examples/basic-typescript/",
"test:haetae": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage -c ../../jest.config.js",
"haetae": "pnpm ts ../../packages/haetae/src/cli.ts",
"ht": "pnpm ts ../../packages/haetae/src/cli.ts"
},
"devDependencies": {
"@types/semver": "^7.5.0",
"haetae": "workspace:*",
"semver": "^7.5.1"
},
"repository": {
"type": "git",
"url": "https://github.com/jjangga0214/haetae.git"
},
"bugs": {
"url": "https://github.com/jjangga0214/haetae/issues"
},
"homepage": "https://github.com/jjangga0214/haetae/examples/basic",
"author": {
"name": "Gil B. Chan",
"email": "[email protected]",
"url": "https://github.com/jjangga0214"
}
}
7 changes: 2 additions & 5 deletions examples/basic-typescript/src/hello.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { pkg } from 'haetae'
export { pkg } from 'haetae'

export default {
name: 'hello',
pkg,
}
export const name = 'hello'
4 changes: 2 additions & 2 deletions examples/basic-typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import hello from './hello.js'
export { name as depName } from './hello.js'

console.log(hello)
export const name = 'index'

1 comment on commit 7491644

@vercel
Copy link

@vercel vercel bot commented on 7491644 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.