Skip to content

Commit

Permalink
Merge pull request #201 from maizzle/fix/resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin authored Apr 13, 2023
2 parents 2c0fae4 + 2f673e7 commit 6e49fad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"inquirer": "^8.0.0",
"np": "*",
"ora": "^5.1.0",
"resolve-cwd": "^3.0.0",
"update-notifier": "^5.0.1"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const {program} = require('commander')
const importCwd = require('import-cwd')
const resolveCwd = require('resolve-cwd')
const updateNotifier = require('update-notifier')

const Project = require('./commands/new.js')
Expand Down Expand Up @@ -44,12 +45,12 @@ module.exports = () => {
.option('-b, --bin [bin]', 'path to the maizzle executable')
.description('compile email templates and output them to disk')
.action(async (env, options) => {
const bin = options.bin || './node_modules/@maizzle/framework/src'
const bin = options.bin || resolveCwd('@maizzle/framework')

await importCwd(bin).build(env)

updateNotifier({
pkg: importCwd('./node_modules/@maizzle/framework/package.json'),
pkg: importCwd(resolveCwd('@maizzle/framework/package.json')),
shouldNotifyInNpmScript: true,
}).notify()
})
Expand All @@ -60,7 +61,7 @@ module.exports = () => {
.option('-nc, --noclear [noclear]', 'do not clear the console log')
.description('start a local development server and watch for file changes')
.action((env, options) => {
const bin = options.bin || './node_modules/@maizzle/framework/src'
const bin = options.bin || resolveCwd('@maizzle/framework')

importCwd(bin).serve(env, {
build: {
Expand All @@ -80,8 +81,7 @@ module.exports = () => {
const pkg = require('../package.json')

try {
const maizzle = importCwd('./node_modules/@maizzle/framework/package.json')
console.log(`Framework v${maizzle.version}\nCLI v${pkg.version}`)
console.log(`Framework v${importCwd(resolveCwd('@maizzle/framework/package.json')).version}\nCLI v${pkg.version}`)
} catch {
console.log(`CLI v${pkg.version}\nTo see your Framework version, run this command in the root directory of a Maizzle project.`)
}
Expand Down

0 comments on commit 6e49fad

Please sign in to comment.