Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unsetsoft/ryunix",
"version": "1.2.3-canary.14",
"version": "1.2.4",
"private": true,
"homepage": "./",
"workspaces": [
Expand All @@ -25,8 +25,8 @@
"kg:bump": "gmvu bump",
"release:canary": "npm run kg:bump && pnpm run format && pnpm --parallel --filter @unsetsoft/ryunixjs run canary:release",
"release:stable": "npm run kg:bump && pnpm run format && pnpm --parallel --filter @unsetsoft/ryunixjs run release",
"cra:release": "pnpm run release --filter @unsetsoft/cra",
"cra:nightly": "pnpm run nightly:release --filter @unsetsoft/cra",
"cra:release": "pnpm --parallel --filter @unsetsoft/cra run release",
"cra:nightly": "pnpm --parallel --filter @unsetsoft/cra run nightly:release",
"changelog": "standard-version --header '# Changelog'",
"git:push": "git push --follow-tags origin",
"run:web": "pnpm --parallel --filter webpack-test run dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/cra/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@unsetsoft/cra",
"description": "Create Ryunix app",
"version": "1.1.18",
"version": "1.1.19",
"author": "Neyunse",
"repository": "https://github.com/UnSetSoft/Ryunixjs",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion packages/cra/templates/Webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"main": "index.js",
"homepage": "./",
"scripts": {
"dev": "ryunix server",
"dev": "ryunix dev",
"start": "ryunix start",
"build": "ryunix build",
"lint": "ryunix lint",
"lint:fix": "ryunix lint --fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/ryunix-presets/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@unsetsoft/ryunix-presets",
"description": "Package with presets for different development environments.",
"version": "1.0.23-canary.54",
"version": "1.0.24",
"author": "Neyunse",
"type": "module",
"repository": "https://github.com/UnSetSoft/Ryunixjs",
Expand Down
3 changes: 2 additions & 1 deletion packages/ryunix-presets/webpack/bin/dev.server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const StartServer = async (cliSettings) => {
`${defaultSettings.webpack.output.buildDirectory}/cache`,
)

const mode = cliSettings.production || defaultSettings.webpack.production ? true : false
const mode =
cliSettings.production || defaultSettings.webpack.production ? true : false

if (!mode) {
cleanCacheDir(cacheDir)
Expand Down
57 changes: 39 additions & 18 deletions packages/ryunix-presets/webpack/bin/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import fs from 'fs'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
import server from './prod.server.mjs'
import config from '../utils/config.cjs';
import config from '../utils/config.cjs'
const __filename = fileURLToPath(import.meta.url)

const __dirname = dirname(__filename)
Expand Down Expand Up @@ -59,6 +59,12 @@ const dev = {
command: 'dev',
describe: 'Run server for developer mode.',
handler: async (arg) => {
if (defaultSettings.webpack.production) {
logger.error(
'You need use development mode! change webpack.production to false in ryunix.config.js.',
)
return
}
const open = Boolean(arg.browser) || false
const settings = {
open,
Expand All @@ -73,19 +79,25 @@ const prod = {
describe: 'Run server for production mode. Requiere .ryunix/static',
handler: async (arg) => {
if (!defaultSettings.webpack.production) {
logger.error("You need use production mode!")
logger.error('You need use production mode!')
return
}

if (!fs.existsSync(join(process.cwd(), config.webpack.output.buildDirectory, 'static'))) {
logger.error("You need build first!")
if (
!fs.existsSync(
join(process.cwd(), config.webpack.output.buildDirectory, 'static'),
)
) {
logger.error('You need build first!')
return
}

server.listen(config.webpack.devServer.port, () => {
console.log(`Server running at http://localhost:${config.webpack.devServer.port}/`);
});
}
console.log(
`Server running at http://localhost:${config.webpack.devServer.port}/`,
)
})
},
}

const build = {
Expand Down Expand Up @@ -126,8 +138,6 @@ const build = {
minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`

if (defaultSettings.webpack.production) {


await Prerender(defaultSettings.webpack.output.buildDirectory)
}

Expand All @@ -149,15 +159,26 @@ const extractHTML = {
handler: async (arg) => {
const runPath = process.cwd()

fs.copyFile(join(__dirname, "..", "template/index.html"), join(runPath, "public/index.html"), (err) => {
if (err) {
console.error("Error extracting HTML: ", err.message);
return;
}
console.log("File extracted successfully. Now you can enable the template with static.customTemplate inside ryunix.config.js");
});
fs.copyFile(
join(__dirname, '..', 'template/index.html'),
join(runPath, 'public/index.html'),
(err) => {
if (err) {
console.error('Error extracting HTML: ', err.message)
return
}
console.log(
'File extracted successfully. Now you can enable the template with static.customTemplate inside ryunix.config.js',
)
},
)
},
}


yargs(hideBin(process.argv)).command(dev).command(build).command(prod).command(lint).command(extractHTML).parse()
yargs(hideBin(process.argv))
.command(dev)
.command(build)
.command(prod)
.command(lint)
.command(extractHTML)
.parse()
6 changes: 3 additions & 3 deletions packages/ryunix-presets/webpack/bin/prerender.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ const Prerender = async (directory) => {

const metaExist = routes.some((route) => route.meta)
if (metaExist && defaultSettings.static.seo.meta.length > 0) {

console.error("[Ryunix Error] You are mixing static and dynamic meta tags; you can only use one of the two. Remove static.seo.meta from ryunix.config.js.")
console.error(
'[Ryunix Error] You are mixing static and dynamic meta tags; you can only use one of the two. Remove static.seo.meta from ryunix.config.js.',
)
process.exit(1)

}

if (routes.length === 0) {
Expand Down
Loading