pulse-js-framework 1.7.17 → 1.7.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.js +212 -0
- package/cli/release.js +3 -2
- package/package.json +1 -1
package/cli/index.js
CHANGED
|
@@ -486,6 +486,11 @@ async function initProject(args) {
|
|
|
486
486
|
mkdirSync(join(cwd, 'src'));
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
+
// Create public directory if it doesn't exist
|
|
490
|
+
if (!existsSync(join(cwd, 'public'))) {
|
|
491
|
+
mkdirSync(join(cwd, 'public'));
|
|
492
|
+
}
|
|
493
|
+
|
|
489
494
|
// Check for existing package.json
|
|
490
495
|
const pkgPath = join(cwd, 'package.json');
|
|
491
496
|
let pkg = {};
|
|
@@ -574,12 +579,219 @@ export default defineConfig({
|
|
|
574
579
|
log.success('Created tsconfig.json');
|
|
575
580
|
}
|
|
576
581
|
|
|
582
|
+
// Create index.html if it doesn't exist
|
|
583
|
+
const indexHtmlPath = join(cwd, 'index.html');
|
|
584
|
+
if (!existsSync(indexHtmlPath)) {
|
|
585
|
+
const mainExt = useTypescript ? 'ts' : 'js';
|
|
586
|
+
const indexHtml = `<!DOCTYPE html>
|
|
587
|
+
<html lang="en">
|
|
588
|
+
<head>
|
|
589
|
+
<meta charset="UTF-8">
|
|
590
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
591
|
+
<title>${projectName}</title>
|
|
592
|
+
</head>
|
|
593
|
+
<body>
|
|
594
|
+
<div id="app"></div>
|
|
595
|
+
<script type="module" src="/src/main.${mainExt}"></script>
|
|
596
|
+
</body>
|
|
597
|
+
</html>
|
|
598
|
+
`;
|
|
599
|
+
writeFileSync(indexHtmlPath, indexHtml);
|
|
600
|
+
log.success('Created index.html');
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// Create main entry file if it doesn't exist
|
|
604
|
+
const mainExt = useTypescript ? 'ts' : 'js';
|
|
605
|
+
const mainPath = join(cwd, 'src', `main.${mainExt}`);
|
|
606
|
+
if (!existsSync(mainPath)) {
|
|
607
|
+
const mainContent = useTypescript
|
|
608
|
+
? `import App from './App.pulse';
|
|
609
|
+
|
|
610
|
+
// Type-safe app mounting
|
|
611
|
+
App.mount('#app');
|
|
612
|
+
|
|
613
|
+
// Enable HMR in development
|
|
614
|
+
if (import.meta.hot) {
|
|
615
|
+
import.meta.hot.accept();
|
|
616
|
+
}
|
|
617
|
+
`
|
|
618
|
+
: `import App from './App.pulse';
|
|
619
|
+
|
|
620
|
+
App.mount('#app');
|
|
621
|
+
`;
|
|
622
|
+
writeFileSync(mainPath, mainContent);
|
|
623
|
+
log.success(`Created src/main.${mainExt}`);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// Create App.pulse if it doesn't exist
|
|
627
|
+
const appPulsePath = join(cwd, 'src', 'App.pulse');
|
|
628
|
+
if (!existsSync(appPulsePath)) {
|
|
629
|
+
const appPulse = `@page App
|
|
630
|
+
|
|
631
|
+
// Welcome to Pulse Framework!
|
|
632
|
+
// Documentation: https://pulse-js.fr
|
|
633
|
+
//
|
|
634
|
+
// Quick links:
|
|
635
|
+
// - Getting Started: https://pulse-js.fr/getting-started
|
|
636
|
+
// - Reactivity (pulse, effect, computed): https://pulse-js.fr/reactivity
|
|
637
|
+
// - DOM Creation (el, mount, list): https://pulse-js.fr/dom
|
|
638
|
+
// - Router: https://pulse-js.fr/router
|
|
639
|
+
// - Store: https://pulse-js.fr/store
|
|
640
|
+
// - Forms: https://pulse-js.fr/forms
|
|
641
|
+
// - CLI Commands: https://pulse-js.fr/cli
|
|
642
|
+
|
|
643
|
+
state {
|
|
644
|
+
count: 0
|
|
645
|
+
name: "Pulse"
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
view {
|
|
649
|
+
#app {
|
|
650
|
+
h1.title "Welcome to {name}!"
|
|
651
|
+
|
|
652
|
+
.counter {
|
|
653
|
+
p "Count: {count}"
|
|
654
|
+
|
|
655
|
+
.buttons {
|
|
656
|
+
button @click(count--) "-"
|
|
657
|
+
button @click(count++) "+"
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
p.info "Edit src/App.pulse and save to hot reload."
|
|
662
|
+
|
|
663
|
+
.docs {
|
|
664
|
+
h2 "Resources"
|
|
665
|
+
ul {
|
|
666
|
+
li {
|
|
667
|
+
a[href=https://pulse-js.fr/getting-started] "Getting Started"
|
|
668
|
+
}
|
|
669
|
+
li {
|
|
670
|
+
a[href=https://pulse-js.fr/reactivity] "Reactivity System"
|
|
671
|
+
}
|
|
672
|
+
li {
|
|
673
|
+
a[href=https://pulse-js.fr/cli] "CLI Commands"
|
|
674
|
+
}
|
|
675
|
+
li {
|
|
676
|
+
a[href=https://github.com/vincenthirtz/pulse-js-framework] "GitHub Repository"
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
style {
|
|
684
|
+
#app {
|
|
685
|
+
font-family: system-ui, -apple-system, sans-serif
|
|
686
|
+
max-width: 600px
|
|
687
|
+
margin: 0 auto
|
|
688
|
+
padding: 40px 20px
|
|
689
|
+
text-align: center
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.title {
|
|
693
|
+
color: #646cff
|
|
694
|
+
font-size: 2.5em
|
|
695
|
+
margin-bottom: 30px
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
.counter {
|
|
699
|
+
background: #f5f5f5
|
|
700
|
+
padding: 30px
|
|
701
|
+
border-radius: 12px
|
|
702
|
+
margin-bottom: 20px
|
|
703
|
+
|
|
704
|
+
p {
|
|
705
|
+
font-size: 1.5em
|
|
706
|
+
margin-bottom: 20px
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.buttons {
|
|
711
|
+
display: flex
|
|
712
|
+
gap: 10px
|
|
713
|
+
justify-content: center
|
|
714
|
+
|
|
715
|
+
button {
|
|
716
|
+
font-size: 1.2em
|
|
717
|
+
padding: 10px 24px
|
|
718
|
+
border: none
|
|
719
|
+
border-radius: 8px
|
|
720
|
+
background: #646cff
|
|
721
|
+
color: white
|
|
722
|
+
cursor: pointer
|
|
723
|
+
transition: background 0.2s
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
button:hover {
|
|
727
|
+
background: #535bf2
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
.info {
|
|
732
|
+
color: #888
|
|
733
|
+
font-size: 0.9em
|
|
734
|
+
margin-bottom: 30px
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.docs {
|
|
738
|
+
text-align: left
|
|
739
|
+
background: #fafafa
|
|
740
|
+
padding: 20px 30px
|
|
741
|
+
border-radius: 12px
|
|
742
|
+
|
|
743
|
+
h2 {
|
|
744
|
+
color: #333
|
|
745
|
+
font-size: 1.2em
|
|
746
|
+
margin-bottom: 15px
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
ul {
|
|
750
|
+
list-style: none
|
|
751
|
+
padding: 0
|
|
752
|
+
margin: 0
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
li {
|
|
756
|
+
margin-bottom: 10px
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
a {
|
|
760
|
+
color: #646cff
|
|
761
|
+
text-decoration: none
|
|
762
|
+
font-size: 0.95em
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
a:hover {
|
|
766
|
+
text-decoration: underline
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
`;
|
|
771
|
+
writeFileSync(appPulsePath, appPulse);
|
|
772
|
+
log.success('Created src/App.pulse');
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
// Create .gitignore if it doesn't exist
|
|
776
|
+
const gitignorePath = join(cwd, '.gitignore');
|
|
777
|
+
if (!existsSync(gitignorePath)) {
|
|
778
|
+
const gitignore = `node_modules
|
|
779
|
+
dist
|
|
780
|
+
.DS_Store
|
|
781
|
+
*.local
|
|
782
|
+
${useTypescript ? '*.tsbuildinfo\n' : ''}`;
|
|
783
|
+
writeFileSync(gitignorePath, gitignore);
|
|
784
|
+
log.success('Created .gitignore');
|
|
785
|
+
}
|
|
786
|
+
|
|
577
787
|
log.info(`
|
|
578
788
|
Initialization complete!
|
|
579
789
|
|
|
580
790
|
Next steps:
|
|
581
791
|
npm install
|
|
582
792
|
npm run dev
|
|
793
|
+
|
|
794
|
+
Documentation: https://pulse-js.fr
|
|
583
795
|
`);
|
|
584
796
|
}
|
|
585
797
|
|
package/cli/release.js
CHANGED
|
@@ -350,14 +350,15 @@ function updateDocsChangelog(newVersion, title, changes) {
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
/**
|
|
353
|
-
* Escape HTML entities
|
|
353
|
+
* Escape HTML entities and convert backticks to <code> tags
|
|
354
354
|
*/
|
|
355
355
|
function escapeHtml(str) {
|
|
356
356
|
return str
|
|
357
357
|
.replace(/&/g, '&')
|
|
358
358
|
.replace(/</g, '<')
|
|
359
359
|
.replace(/>/g, '>')
|
|
360
|
-
.replace(/"/g, '"')
|
|
360
|
+
.replace(/"/g, '"')
|
|
361
|
+
.replace(/`([^`]+)`/g, '<code>$1</code>');
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
/**
|