@nowline/export-msproj 0.2.0
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/LICENSE +190 -0
- package/README.md +116 -0
- package/dist/calendar.d.ts +7 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +59 -0
- package/dist/calendar.js.map +1 -0
- package/dist/duration.d.ts +3 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/duration.js +51 -0
- package/dist/duration.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +369 -0
- package/dist/index.js.map +1 -0
- package/dist/xml.d.ts +4 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +18 -0
- package/dist/xml.js.map +1 -0
- package/package.json +36 -0
- package/src/calendar.ts +63 -0
- package/src/duration.ts +48 -0
- package/src/index.ts +483 -0
- package/src/xml.ts +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Lolay, Inc.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @nowline/export-msproj
|
|
2
|
+
|
|
3
|
+
Microsoft Project XML export. Projects a Nowline AST onto Microsoft
|
|
4
|
+
Project's import schema (`.xml`, the format that opens directly in MS
|
|
5
|
+
Project Standard / Pro and imports cleanly into Project Online and
|
|
6
|
+
Project for the Web). Pure strings — no Node-only dependencies.
|
|
7
|
+
|
|
8
|
+
**License:** Apache 2.0
|
|
9
|
+
**Part of:** [`lolay/nowline`](../../) monorepo
|
|
10
|
+
**Spec:** [`specs/handoffs/m2c.md`](../../specs/handoffs/m2c.md) § 8
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @nowline/export-msproj @nowline/export-core
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { exportMsProjXml } from '@nowline/export-msproj';
|
|
22
|
+
|
|
23
|
+
const xml = exportMsProjXml(inputs, {
|
|
24
|
+
projectName: 'Q1 2026 Plan',
|
|
25
|
+
startDate: '2026-01-06', // YYYY-MM-DD; anchors relative roadmaps
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// `xml` is a UTF-8 XML string. Save as roadmap.xml.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
CLI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
nowline roadmap.nowline -f msproj -o roadmap.xml
|
|
35
|
+
nowline roadmap.nowline -f ms-project -o roadmap.xml # alias
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`.xml` is *intentionally not* an inferred extension — `nowline -o
|
|
39
|
+
roadmap.xml` without `-f msproj` exits 2 with a "use `-f msproj`" message
|
|
40
|
+
because XML is ambiguous (could be SVG-XML, generic XML, etc.).
|
|
41
|
+
|
|
42
|
+
## Output shape
|
|
43
|
+
|
|
44
|
+
```xml
|
|
45
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
46
|
+
<Project xmlns="http://schemas.microsoft.com/project">
|
|
47
|
+
<Name>Q1 2026 Plan</Name>
|
|
48
|
+
<StartDate>2026-01-06T00:00:00</StartDate>
|
|
49
|
+
<Calendars>
|
|
50
|
+
<!-- Standard base calendar (Mon-Fri, 8h) + Standard resource calendar -->
|
|
51
|
+
</Calendars>
|
|
52
|
+
<Tasks>
|
|
53
|
+
<Task><UID>1</UID><Name>Auth refactor</Name>...</Task>
|
|
54
|
+
...
|
|
55
|
+
</Tasks>
|
|
56
|
+
<Resources>
|
|
57
|
+
<Resource><UID>1</UID><Name>Sam</Name>...</Resource>
|
|
58
|
+
...
|
|
59
|
+
</Resources>
|
|
60
|
+
<Assignments>
|
|
61
|
+
...
|
|
62
|
+
</Assignments>
|
|
63
|
+
</Project>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Calendar fidelity
|
|
67
|
+
|
|
68
|
+
Per spec Resolution 6, this exporter emits a **single Standard base
|
|
69
|
+
calendar** (`UID="1"`, Mon–Fri 08:00–12:00 / 13:00–17:00, weekends off)
|
|
70
|
+
plus a Standard resource calendar (`UID="2"`) that every `<Resource>`
|
|
71
|
+
references. This matches Microsoft's own default template and reliably
|
|
72
|
+
imports across MS Project versions.
|
|
73
|
+
|
|
74
|
+
Nowline's richer `calendar:` modes (`full` for 7-day weeks, `custom` for
|
|
75
|
+
per-region holidays / half-days) are **not** projected into the export —
|
|
76
|
+
duration math is recomputed against MS Project's Standard calendar so a
|
|
77
|
+
`duration: 2w` item lands on the same 10 working days you'd see in
|
|
78
|
+
Nowline's default `business` calendar.
|
|
79
|
+
|
|
80
|
+
## Lossy export policy
|
|
81
|
+
|
|
82
|
+
The following Nowline features are dropped from the export:
|
|
83
|
+
|
|
84
|
+
- `label`, `style`, custom `status` definitions
|
|
85
|
+
- `footnote` annotations
|
|
86
|
+
- `description` directives (the bridge to `<Notes>` is reserved for a
|
|
87
|
+
future milestone)
|
|
88
|
+
- Custom calendar configuration
|
|
89
|
+
|
|
90
|
+
When any drops occur, the exporter emits a single stderr summary line
|
|
91
|
+
(via the CLI; the library function returns the XML and lets the caller
|
|
92
|
+
decide). Per Resolution 9, `--strict` does *not* escalate; lossy export
|
|
93
|
+
always succeeds.
|
|
94
|
+
|
|
95
|
+
The export is one-way only — there is no MS Project XML → Nowline
|
|
96
|
+
importer. Round-tripping is a future-milestone concern.
|
|
97
|
+
|
|
98
|
+
## Options
|
|
99
|
+
|
|
100
|
+
| Option | Default | Notes |
|
|
101
|
+
|---------------|-------------------------------|-------|
|
|
102
|
+
| `projectName` | roadmap title | `<Name>` element. |
|
|
103
|
+
| `startDate` | `inputs.today` or `2026-01-05`| Anchors relative-only roadmaps. Defaults to `today` if set, otherwise `2026-01-05` (a deterministic Monday) so tests are stable. |
|
|
104
|
+
|
|
105
|
+
## Determinism
|
|
106
|
+
|
|
107
|
+
- No `new Date()`. The anchor date is `options.startDate` → `inputs.today`
|
|
108
|
+
→ fixed `2026-01-05` fallback.
|
|
109
|
+
- Calendar UIDs are fixed (`1`, `2`); Tasks/Resources are numbered
|
|
110
|
+
sequentially in AST order.
|
|
111
|
+
- Snapshots in `test/__snapshots__/` regenerate via `vitest -u`. A
|
|
112
|
+
secondary test asserts the root element name and namespace.
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
Apache-2.0.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const DAY_NAMES: string[];
|
|
2
|
+
export declare function buildCalendarsBlock(): string;
|
|
3
|
+
/** Resource and base calendar UIDs surfaced for cross-references. */
|
|
4
|
+
export declare const STANDARD_BASE_CALENDAR_UID = 1;
|
|
5
|
+
export declare const STANDARD_RESOURCE_CALENDAR_UID = 2;
|
|
6
|
+
export { DAY_NAMES };
|
|
7
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../src/calendar.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,SAAS,UAAiF,CAAC;AA0BjG,wBAAgB,mBAAmB,IAAI,MAAM,CAmB5C;AAED,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/calendar.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Minimal Standard base calendar emitted on every MS Project XML export.
|
|
2
|
+
//
|
|
3
|
+
// Spec: specs/handoffs/m2c.md § 8 + Resolution 6.
|
|
4
|
+
// - One base calendar (UID=1, Name=Standard) — Mon–Fri working
|
|
5
|
+
// 08:00–12:00 / 13:00–17:00, Sat/Sun non-working. Matches Microsoft's
|
|
6
|
+
// default project template; reliably accepted across MSProject versions.
|
|
7
|
+
// - One resource calendar (UID=2, Name=Standard, BaseCalendarUID=1).
|
|
8
|
+
//
|
|
9
|
+
// Calendar UIDs are fixed (1 / 2). No timestamps in the calendar block →
|
|
10
|
+
// deterministic across runs.
|
|
11
|
+
const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
12
|
+
function dayBlock(dayIndex) {
|
|
13
|
+
const isWeekend = dayIndex === 0 || dayIndex === 6;
|
|
14
|
+
if (isWeekend) {
|
|
15
|
+
return ` <WeekDay>
|
|
16
|
+
<DayType>${dayIndex + 1}</DayType>
|
|
17
|
+
<DayWorking>0</DayWorking>
|
|
18
|
+
</WeekDay>`;
|
|
19
|
+
}
|
|
20
|
+
return ` <WeekDay>
|
|
21
|
+
<DayType>${dayIndex + 1}</DayType>
|
|
22
|
+
<DayWorking>1</DayWorking>
|
|
23
|
+
<WorkingTimes>
|
|
24
|
+
<WorkingTime>
|
|
25
|
+
<FromTime>08:00:00</FromTime>
|
|
26
|
+
<ToTime>12:00:00</ToTime>
|
|
27
|
+
</WorkingTime>
|
|
28
|
+
<WorkingTime>
|
|
29
|
+
<FromTime>13:00:00</FromTime>
|
|
30
|
+
<ToTime>17:00:00</ToTime>
|
|
31
|
+
</WorkingTime>
|
|
32
|
+
</WorkingTimes>
|
|
33
|
+
</WeekDay>`;
|
|
34
|
+
}
|
|
35
|
+
export function buildCalendarsBlock() {
|
|
36
|
+
const weekDays = [0, 1, 2, 3, 4, 5, 6].map(dayBlock).join('\n');
|
|
37
|
+
return ` <Calendars>
|
|
38
|
+
<Calendar>
|
|
39
|
+
<UID>1</UID>
|
|
40
|
+
<Name>Standard</Name>
|
|
41
|
+
<IsBaseCalendar>1</IsBaseCalendar>
|
|
42
|
+
<BaseCalendarUID>-1</BaseCalendarUID>
|
|
43
|
+
<WeekDays>
|
|
44
|
+
${weekDays}
|
|
45
|
+
</WeekDays>
|
|
46
|
+
</Calendar>
|
|
47
|
+
<Calendar>
|
|
48
|
+
<UID>2</UID>
|
|
49
|
+
<Name>Standard</Name>
|
|
50
|
+
<IsBaseCalendar>0</IsBaseCalendar>
|
|
51
|
+
<BaseCalendarUID>1</BaseCalendarUID>
|
|
52
|
+
</Calendar>
|
|
53
|
+
</Calendars>`;
|
|
54
|
+
}
|
|
55
|
+
/** Resource and base calendar UIDs surfaced for cross-references. */
|
|
56
|
+
export const STANDARD_BASE_CALENDAR_UID = 1;
|
|
57
|
+
export const STANDARD_RESOURCE_CALENDAR_UID = 2;
|
|
58
|
+
export { DAY_NAMES };
|
|
59
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../src/calendar.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,kDAAkD;AAClD,iEAAiE;AACjE,0EAA0E;AAC1E,6EAA6E;AAC7E,uEAAuE;AACvE,EAAE;AACF,yEAAyE;AACzE,6BAA6B;AAE7B,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAEjG,SAAS,QAAQ,CAAC,QAAgB;IAC9B,MAAM,SAAS,GAAG,QAAQ,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC;IACnD,IAAI,SAAS,EAAE,CAAC;QACZ,OAAO;mBACI,QAAQ,GAAG,CAAC;;iBAEd,CAAC;IACd,CAAC;IACD,OAAO;mBACQ,QAAQ,GAAG,CAAC;;;;;;;;;;;;iBAYd,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,mBAAmB;IAC/B,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO;;;;;;;EAOT,QAAQ;;;;;;;;;eASK,CAAC;AAChB,CAAC;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../src/duration.ts"],"names":[],"mappings":"AA0BA,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAiB3E;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D"}
|
package/dist/duration.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Convert Nowline duration tokens into MS Project's `PT...H...M...S` form.
|
|
2
|
+
//
|
|
3
|
+
// MS Project uses ISO 8601 duration "PT<minutes>M0S" (e.g. `PT480M0S` = 8h)
|
|
4
|
+
// for Standard-calendar working time. We resolve every duration to working
|
|
5
|
+
// minutes under the calendar emitted by `calendar.ts` (Mon–Fri, 8h/day).
|
|
6
|
+
//
|
|
7
|
+
// Size buckets resolve the same way as in @nowline/export-mermaid.
|
|
8
|
+
const SIZE_BUCKET_DAYS = {
|
|
9
|
+
xs: 1,
|
|
10
|
+
sm: 3,
|
|
11
|
+
s: 3,
|
|
12
|
+
md: 5,
|
|
13
|
+
m: 5,
|
|
14
|
+
lg: 10,
|
|
15
|
+
l: 10,
|
|
16
|
+
xl: 15,
|
|
17
|
+
};
|
|
18
|
+
const NUMERIC_RE = /^(\d+(?:\.\d+)?)\s*(d|w|m|y)?$/i;
|
|
19
|
+
const MINUTES_PER_WORKING_DAY = 8 * 60; // Standard calendar
|
|
20
|
+
const WORKING_DAYS_PER_WEEK = 5;
|
|
21
|
+
const WORKING_DAYS_PER_MONTH = 22;
|
|
22
|
+
const WORKING_DAYS_PER_YEAR = 252;
|
|
23
|
+
export function durationToMsProjMinutes(literal) {
|
|
24
|
+
if (!literal)
|
|
25
|
+
return MINUTES_PER_WORKING_DAY; // 1d default
|
|
26
|
+
const trimmed = literal.trim().toLowerCase();
|
|
27
|
+
if (!trimmed)
|
|
28
|
+
return MINUTES_PER_WORKING_DAY;
|
|
29
|
+
if (trimmed in SIZE_BUCKET_DAYS) {
|
|
30
|
+
return SIZE_BUCKET_DAYS[trimmed] * MINUTES_PER_WORKING_DAY;
|
|
31
|
+
}
|
|
32
|
+
const match = NUMERIC_RE.exec(trimmed);
|
|
33
|
+
if (!match)
|
|
34
|
+
return MINUTES_PER_WORKING_DAY;
|
|
35
|
+
const value = Number(match[1]);
|
|
36
|
+
const unit = (match[2] ?? 'd').toLowerCase();
|
|
37
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
38
|
+
return MINUTES_PER_WORKING_DAY;
|
|
39
|
+
let days = value;
|
|
40
|
+
if (unit === 'w')
|
|
41
|
+
days = value * WORKING_DAYS_PER_WEEK;
|
|
42
|
+
else if (unit === 'm')
|
|
43
|
+
days = value * WORKING_DAYS_PER_MONTH;
|
|
44
|
+
else if (unit === 'y')
|
|
45
|
+
days = value * WORKING_DAYS_PER_YEAR;
|
|
46
|
+
return Math.round(days * MINUTES_PER_WORKING_DAY);
|
|
47
|
+
}
|
|
48
|
+
export function minutesToMsProjDuration(minutes) {
|
|
49
|
+
return `PT${Math.max(0, Math.round(minutes))}M0S`;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../src/duration.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,yEAAyE;AACzE,EAAE;AACF,mEAAmE;AAEnE,MAAM,gBAAgB,GAAqC;IACvD,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,EAAE;IACN,CAAC,EAAE,EAAE;IACL,EAAE,EAAE,EAAE;CACT,CAAC;AAEF,MAAM,UAAU,GAAG,iCAAiC,CAAC;AAErD,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,oBAAoB;AAC5D,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,UAAU,uBAAuB,CAAC,OAA2B;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO,uBAAuB,CAAC,CAAC,aAAa;IAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7C,IAAI,CAAC,OAAO;QAAE,OAAO,uBAAuB,CAAC;IAC7C,IAAI,OAAO,IAAI,gBAAgB,EAAE,CAAC;QAC9B,OAAO,gBAAgB,CAAC,OAAO,CAAC,GAAG,uBAAuB,CAAC;IAC/D,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK;QAAE,OAAO,uBAAuB,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,uBAAuB,CAAC;IAC1E,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,IAAI,KAAK,GAAG;QAAE,IAAI,GAAG,KAAK,GAAG,qBAAqB,CAAC;SAClD,IAAI,IAAI,KAAK,GAAG;QAAE,IAAI,GAAG,KAAK,GAAG,sBAAsB,CAAC;SACxD,IAAI,IAAI,KAAK,GAAG;QAAE,IAAI,GAAG,KAAK,GAAG,qBAAqB,CAAC;IAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,uBAAuB,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACnD,OAAO,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;AACtD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExportInputs } from '@nowline/export-core';
|
|
2
|
+
export interface MsProjOptions {
|
|
3
|
+
/** Project name attribute. Defaults to roadmap title. */
|
|
4
|
+
projectName?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Anchor date (YYYY-MM-DD). MS Project needs absolute Start dates;
|
|
7
|
+
* relative-only Nowline roadmaps anchor every task here. Falls back to
|
|
8
|
+
* `inputs.today` (UTC midnight) if absent; and if that is also absent,
|
|
9
|
+
* to `2026-01-05` (a deterministic Monday) so tests are stable.
|
|
10
|
+
*
|
|
11
|
+
* Documented as not round-trippable.
|
|
12
|
+
*/
|
|
13
|
+
startDate?: string;
|
|
14
|
+
/** Test seam: receives the lossy summary instead of stderr. */
|
|
15
|
+
onLossy?: (message: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function exportMsProjXml(inputs: ExportInputs, options?: MsProjOptions): string;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAOzD,MAAM,WAAW,aAAa;IAC1B,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAmCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAgFzF"}
|